Use the code below to re-define the standardize() function and to create a vector with standardized numbers.
standardize <- function (x) {
(x - mean(x, na.rm = TRUE)) / sd(x, na.rm = TRUE)
}
standardized_vector <-
standardize(sample(1:100, 30))
pi using a for()-loop.
pi. Just type pi and you’ll receive 3.141593. Also, you need to wrap everything within the print() function.
sapply() function for that.
print() function anymore.
lapply() or purrr::map.